import Vue from 'vue'
import Vuex from 'vuex'
import actions from '../actions/auth'
import { UPDATE_USER, UPDATE_SITE_ID, UPDATE_REDIRECT_META_DATA} from '../mutation-types'

Vue.use(Vuex)

const state = {
  'count': 0,
  'site_id': null,
  'user': {
    'my_team_list': ''
  },
  'redirect_meta_data': null
}

const mutations = {
  INCREMENT (state) {
    state.count++
  },
  DECREMENT (state) {
    state.count--
  },
  [UPDATE_USER] (state, user) {
    state.user = user
  },
  [UPDATE_SITE_ID] (state, site_id) {
    state.site_id = site_id
  },
  [UPDATE_REDIRECT_META_DATA] (state, redirectMetaData) {
    state.redirect_meta_data = redirectMetaData
  },
}

export default {
  state,
  mutations,
  actions
}
